package org.example.sdk;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.stereotype.Component;

@SpringBootApplication
@Slf4j
public class SdkSampleApp {
    public static void main(String[] args) {
        SpringApplication.run(SdkSampleApp.class, args);
    }

    @Component
    static class Runner implements CommandLineRunner {

        @Autowired
        private ResourceService resourceService;

        @Override
        public void run(String... args) throws Exception {
            Iterable<User> users = resourceService.findAsStream(User.class, "user", 10);
            for (User user : users) {
                log.info("{}", user);
            }
        }
    }
}